var app = new Vue({
  el: '#app',
  data: {
    eng: '...',
    cn: '...',
    showEn:false
  }
})

var opt = new Vue({
  el: '#opt',
  data: {
    showNextBtn : false
  },
  methods:{
  	forget:function(e){
  	    app.showEn = true;
  	    opt.showNextBtn = true;
  	},
  	next:function(e){
  	    app.showEn = false;
  	    opt.showNextBtn = false;
  	    getNextContent();
  	}
  }
})

getNextContent();

//Get next sentence
function getNextContent(){

	app.cn = '...';
	app.showEn = false;

	var xhttp = new XMLHttpRequest();
	xhttp.onreadystatechange = function() {
	if (this.readyState == 4 && this.status == 200) {
	  var rsp = JSON.parse(this.responseText);
	  app.eng = rsp.enContent;
	  app.cn = rsp.cnContent;
	}
	};
	xhttp.open("GET", "/directory/random", true);
	xhttp.send();
}
